package com.go.where.family.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.go.where.family.constants.Constant;
import com.go.where.family.dao.CustomerCommentDao;
import com.go.where.family.pojo.CustomerCommentInfo;
import com.go.where.family.service.CustomerCommentService;

@Service("customerCommentService")
public class CustomerCommentServiceImpl implements CustomerCommentService {

	@Resource(name = "customerCommentDao")
	private CustomerCommentDao customerCommentDao;

	@Override
	public int save(CustomerCommentInfo customerInfo) {
		customerInfo.setId(UUID.randomUUID().toString());
		customerInfo.setCommentTime(new Date());
		customerInfo.setIsDelete(Constant.IS_NOT_DELETE);
		return customerCommentDao.insert(customerInfo);
	}

	@Override
	public List<CustomerCommentInfo> queryList(Map<String, Object> map) {
		return customerCommentDao.queryT(map);
	}

	@Override
	public Integer queryCount(Map<String, Object> map) {
		return customerCommentDao.queryCount(map);
	}

	@Override
	public int update(CustomerCommentInfo customerInfo) {
		return customerCommentDao.update(customerInfo);
	}

	@Override
	public String queryLastOneComment(String customerId) {
		return customerCommentDao.queryLastOneComment(customerId);
	}

	@Override
	public List<String> queryByTypeAndAid(CustomerCommentInfo comment) {
		return customerCommentDao.queryByTypeAndAid(comment);
	}

}
